<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sd" uri="/struts-dojo-tags" %>


<script type="text/javascript" src="<s:url value="/js/jquery/jquery.collapse.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/protocollevel.js"/>"></script>


<div id="filter"  class="tableFilter" >
    <s:form  id="formEdit" cssClass="tableFilter" cssStyle="width: 85%"  >

        <tr>
            <th colspan="2" class="tableTitle">
                <h5>Protocol Level Documents</h5>
            </th>
        </tr>


        <s:hidden name="id" id="id" value="%{protocolLevelDocumentation.id}" ></s:hidden>

        <s:select label="Category" name="protocolLevelDocumentationCategory.id" id="category"  value="%{protocolLevelDocumentation.protocolLevelDocumentationCategory.id}"
                  headerKey="" headerValue="Choose a Category"
                  list="categories"
                  listKey="id"
                  listValue="descripcion"
                  onchange="isOtherCategory(this.value)">
        </s:select>
        <s:textfield label="Other" id="otherCategory" ></s:textfield>
        <s:hidden  name="protocolLevelDocumentationCategory.descripcion" id="protocolLevelDocumentationCategoryD" value="%{protocolLevelDocumentation.protocolLevelDocumentationCategory.descripcion}"/>
        <s:textfield label="Description" name="description" id="description" value="%{protocolLevelDocumentation.description}"  />

        <s:url var="searchSiteURL" action="getSites"  namespace="/"/>
        <s:updownselect
                id="country"
                label="Country Scope"
                list="compromisopaisList"
                listValue="country"
                listKey="country"
                allowMoveDown="false"
                allowMoveUp="false"
                allowSelectAll="false"
                name="compromisopaisListSelect"

                ></s:updownselect>

        <s:textfield label="Version" name="version" id="version" value="%{protocolLevelDocumentation.version}"  />


        <s:hidden name="dated" id="altdated" value="%{protocolLevelDocumentation.dated}"/>
        <s:textfield label="Dated" id="dated" cssClass="datepicker"/>

        <s:hidden name="receivedBms" id="altreceivedBms" value="%{protocolLevelDocumentation.receivedBms}"/>
        <s:textfield label="Received at BMS" id="receivedBms"  cssClass="datepicker"  />

         <tr id="trPL" >
            <td>
                <label  >Is Part of the Initial Package?: </label>
            </td>
            <td>
                <s:checkbox labelposition="left" label="Is Part of the Initial Package?"  name="partOfInitialPackage" id="partOfInitialPackage" theme="simple" value="%{protocolLevelDocumentation.partOfInitialPackage}" />

            </td>
        </tr>

        <s:hidden name="sentToPrism" id="altsentToPrism" value="%{protocolLevelDocumentation.sentToPrism}"/>
        <s:textfield label="Sent to Prism" id="sentToPrism"  cssClass="datepicker"  />

        <s:hidden name="confirmedPrism" id="altconfirmedPrism" value="%{protocolLevelDocumentation.confirmedPrism}"/>
        <s:textfield label="Confirmed Prism" id="confirmedPrism"  cssClass="datepicker"  />

        <s:hidden name="sentToMoh" id="altsentToMoh" value="%{protocolLevelDocumentation.sentToMoh}"/>
        <s:textfield label="Sent to MOH" id="sentToMoh" cssClass="datepicker"  />

        <s:hidden name="approvalMoh" id="altapprovalMoh" value="%{protocolLevelDocumentation.approvalMoh}"/>
        <s:textfield label="MOH Approval" id="approvalMoh"  cssClass="datepicker"  />

        <s:hidden name="sampleIfcReviewForm" id="altsampleIfcReviewForm" value="%{protocolLevelDocumentation.sampleIfcReviewForm}"/>
        <s:textfield label="SAMPLE ICF Review Form"  id="sampleIfcReviewForm" cssClass="datepicker"  />


        <tr>
            <td colspan="2">
        <div id="translation-show-hide" class="collapse" style="width: 85%">
            <h2>Translation</h2>
            <div>
                 <table>
                     <s:url var="searchUserURL" action="getTranslatorsByName"  namespace="/Directories/Translators"/>
                     <tr>
                         <td>
                             <label  >Translator Name:</label>
                         </td>
                         <td>
                             <s:textfield label="Translator Name" theme="simple" name="translator" id="translator"  />
                             <s:a href="#" onclick="searchTraductor($('#translator').val(), '%{searchUserURL}', 'translator')" theme="simple" ><img  src="<s:url value="/images/search.png"/>" alt="search"></s:a>

                         </td>
                     </tr>
                     <s:hidden id="hdNameTranslator" name="hdNameTranslator"></s:hidden>
                     <s:hidden id="hdTranslatorID" name="hdTranslatorID"></s:hidden>


                     <s:textfield label="Translation Budget (USD)" name="translationBudget" id="translationBudget" value="%{protocolLevelDocumentation.translationBudget}"  />

                     <s:hidden name="sentToTranslator" id="altsentToTranslator" value="%{protocolLevelDocumentation.sentToTranslator}"/>
                     <s:textfield label="Sent to translator" id="sentToTranslator" cssClass="datepicker"  />

                     <s:hidden name="translationReady" id="alttranslationReady" value="%{protocolLevelDocumentation.translationReady}"/>
                     <s:textfield label="Target date for translation ready" id="translationReady" cssClass="datepicker"  />

                     <s:hidden name="receivedFromTranslator" id="altreceivedFromTranslator" value="%{protocolLevelDocumentation.receivedFromTranslator}"/>
                     <s:textfield label="Received from translator"  id="receivedFromTranslator" cssClass="datepicker"  />

                     <tr>
                         <td>
                             <label>Translator rate:</label>
                         </td>
                         <td>
                             <s:select label="Translation rate" name="translatorRate" id="translatorRate"  value="%{protocolLevelDocumentation.translatorRate}"
                                       headerKey="" headerValue="Choose a Translator rate"
                                       list="translationRate"
                                       theme="simple">
                             </s:select>
                         </td>
                     </tr>
                     <s:textarea label="Comments" rows="4" cols="40" name="translatorRateComments" id="translatorRateComments" value="%{protocolLevelDocumentation.translatorRateComments}" ></s:textarea>

                    <tr>
                        <td colspan="2">
                            <br /> <br />
                        </td>
                    </tr>
                     <tr>
                         <td>
                             <label  >Translation reviewer name:</label>
                         </td>
                         <td>
                             <s:textfield label="Translator Name" theme="simple" name="translatorReviewer" id="translatorReviewer"  />
                             <s:a href="#" onclick="searchTraductor($('#translatorReviewer').val(), '%{searchUserURL}', 'translatorReviewer')" theme="simple"  ><img src="<s:url value="/images/search.png"/>" alt="search"></s:a>

                         </td>
                     </tr>
                     <s:hidden id="hdTranslatorReviewerID" name="hdTranslatorReviewerID"></s:hidden>
                     <s:textfield label="Translation review budget (USD)" name="translationReviewBudget" id="translationReviewBudget" value="%{protocolLevelDocumentation.translationReviewBudget}" />

                     <s:hidden name="sentToTranslationReviewer" id="altsentToTranslationReviewer" value="%{protocolLevelDocumentation.sentToTranslationReviewer}"/>
                     <s:textfield label="Sent to translation reviewer" id="sentToTranslationReviewer" cssClass="datepicker"  />

                     <s:hidden name="translationRevisionReady" id="alttranslationRevisionReady" value="%{protocolLevelDocumentation.translationRevisionReady}"/>
                     <s:textfield label="Target date for translation revision ready" id="translationRevisionReady"  cssClass="datepicker"  />

                     <s:hidden name="receivedFromTranslationReviewer" id="altreceivedFromTranslationReviewer" value="%{protocolLevelDocumentation.receivedFromTranslationReviewer}"/>
                     <s:textfield label="Received from translation reviewer" id="receivedFromTranslationReviewer" cssClass="datepicker"  />

                     <tr>
                         <td>
                             <label>Translation review rate:</label>
                         </td>
                         <td>
                             <s:select label="Translation review rate" name="translatorReviewRate" id="translatorReviewRate"   value="%{protocolLevelDocumentation.translatorReviewRate}"
                                       headerKey="" headerValue="Choose a Translator rate"
                                       list="translationRate"
                                       theme="simple">
                             </s:select>
                         </td>
                     </tr>
                     <s:textarea label="Comments " rows="4" cols="40" name="translatorReviewRateComments" id="translatorReviewRateComments" value="%{protocolLevelDocumentation.translatorReviewRateComments}" ></s:textarea>
                     <tr>
                         <td colspan="2">
                             <br /><br />
                         </td>
                     </tr>

                     <s:hidden name="translationCertificate" id="alttranslationCertificate" value="%{protocolLevelDocumentation.translationCertificate}"/>
                     <s:textfield label="Translation Certificate (optional)" id="translationCertificate" cssClass="datepicker"  />

                     <s:hidden name="translationReviewForm" id="alttranslationReviewForm" value="%{protocolLevelDocumentation.translationReviewForm}"/>
                     <s:textfield label="Translation review Form" id="translationReviewForm" cssClass="datepicker"  />


                </table>


            </div>
        </div>



                 </td>
            </tr>

        <tr>
            <td colspan="2" class="centeredButtons">
                <s:submit value="Save" id="save" action="save" onclick="validate();beforeSave();" theme="simple" />
                <s:form action="main" method="POST" theme="simple" >
                    <s:submit value="Clear" onclick="$('#protocolLevelDocumentationId').val(null);" theme="simple" ></s:submit>
                </s:form>
            </td>
        </tr>


        <s:if test="%{protocolLevelDocumentation.id != null}">
            <script type="text/javascript">
                var ids=new Array();
                ids[0] =  ["translation-show-hide",true];
                loadCollapse(ids);
            </script>
        </s:if>
        <s:else>
            <script type="text/javascript">
                var ids=new Array();
                ids[0] =  ["translation-show-hide",false];
                loadCollapse(ids);
            </script>

        </s:else>

    </s:form>

  </div>

<br/>

<s:if test="!list.isEmpty()">
    <div id="table_content">
        <table>
            <thead>
            <tr>
                <th>Category</th>
                <th>Description</th>
                <th>Countries</th>
                <th>Version</th>
                <th>Dated</th>
                <th>Received BMS</th>
                <th></th>
            </tr>
            </thead>
            <tbody>
                <s:url var="editURL" action="edit"  namespace="/Staff"/>
            <s:iterator value="list" var="documentation">
            <tr>
                <th><s:property value="protocolLevelDocumentationCategory.descripcion"/></th>
                <th><s:property value="description"/></th>
                <th>  <s:iterator value="protocoloCompromisopaises" var="pais">
                    <s:property value="compromisopais.country"/>,
                </s:iterator>
                </th>
                <th><s:property value="version"/></th>
                <th><s:property value="dated"  /></th>
                <th><s:property value="receivedBms"/></th>
                <th>
                    <s:form action="main" method="POST">
                        <s:url value="/images/edit.png" id="imageEdit"/>
                        <s:hidden id="protocolLevelDocumentationId" value="%{id}" name="protocolLevelDocumentationId"/>
                        <s:submit type="image" src="%{imageEdit}" cssStyle="width: 20px;height: 20px;" value="Edit"  ></s:submit>
                    </s:form>
                </th>
            </tr>
            </s:iterator>

            <tbody>
        </table>
    </div>
</s:if>

<script type="text/javascript">


    selectItemMenu("pld");
    $("#otherCategory").parent().parent().hide();
    $("#sampleIfcReviewForm").parent().parent().hide();




</script>




</script>